package com.example.lending.Model;

import android.content.Context;
import android.content.SharedPreferences;

import com.example.lending.R;

public class MyData {
    Context context;
    public int islogin;
    public String username_key;
    public String password_key;
    public String shp_name;
    public MyData(Context context){
        this.context=context;
        username_key=context.getResources().getString(R.string.data_username_key);
        password_key=context.getResources().getString(R.string.data_password_key);
        shp_name=context.getResources().getString(R.string.shp_name);
    }

    public void saveYes(){
        SharedPreferences shp=context.getSharedPreferences("My_data",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = shp.edit();
        editor.putInt("islogin",1);
        editor.apply();
    }
    public void saveNo(){
        SharedPreferences shp=context.getSharedPreferences("My_data",Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = shp.edit();
        editor.putInt("islogin",0);
        editor.apply();
    }

    public  int load(){
        SharedPreferences shp=context.getSharedPreferences("My_data",Context.MODE_PRIVATE);
        int x = shp.getInt("islogin",0);
        return x;
    }

}
